home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Software of the Month Club / Amiga General Interest Volume 210 (1995-03)(SOMC)(Disk 2 of 5)[SMC210C30I2].zip / Amiga General Interest Volume 210 (1995-03)(SOMC)(Disk 2 of 5)[SMC210C30I2].adf / MathScript / Rexx / InsertFormula.ms < prev    next >
Text File  |  1995-05-26  |  3KB  |  119 lines

  1. /* This script is for the use with FinalWriter®.
  2. For the detailed description of how to connect MathScript and FinalWriter® 
  3. via ARexx, see the file FinalWriter.guide in your Docs drawer */
  4.  
  5. /*************************************************************************
  6. This script can use the current font size and color of FinalWriter.
  7. If you do not want it to use the current font size, set use_size="No".
  8. If you do not want it to use the current font color, set use_color="No"
  9. You maybe should create different script files with different settings if
  10. you often need different settings.
  11. *************************************************************************
  12. Dieses Script benutzt die in FinalWriter eingestellte Font-Größe und -Farbe.
  13. Wenn Sie nicht die aktuelle Font-Größe benutzen wollen, setzen Sie: use_size="No".
  14. Wenn Sie nicht die aktuelle Farbe benutzen wollen, setzen Sie: use_color="No".
  15. Wenn Sie häufig verschiedene Einstellungen für dieses Script brauchen,
  16. erstellen Sie doch einfach mehrere Versionen!
  17. *************************************************************************/
  18.  
  19. use_size="Yes"
  20.  
  21. use_color="Yes"
  22.  
  23.  
  24. options results
  25.  
  26. IF ~SHOW('p',"FINALW.1") THEN EXIT
  27. /* If FW does not run -> quit */
  28.  
  29. DO i=0 WHILE EXISTS("T:formula"||i)
  30. END
  31.  
  32. ADDRESS FINALW.1
  33.  
  34. STATUS FONTSIZE
  35. size=result
  36. /* Get the current font size */
  37.  
  38. STATUS FONTCOLOR
  39. colorname=result
  40. /* Get the current color */
  41.  
  42. GETDOCCOLORPREFS colorname
  43. color=result
  44. PARSE VAR color r g b
  45. r=r*16
  46. g=g*16
  47. b=b*16
  48. /* convert color to 8bit R,G,B values */
  49.  
  50. STATUS PAGE "Insert"
  51. page=result
  52. /* The formula will be inserted into the current page */
  53.  
  54. ADDRESS "MATHSCRIPT.1"
  55.  
  56. GETGENERALPREFS FONTSIZE
  57. old_size=result
  58.  
  59. IF use_size="Yes" THEN
  60.     SETGENERALPREFS FONTSIZE size
  61. /* Use the current font size if use_size=Yes*/
  62.  
  63. GETGENERALPREFS FG
  64. old_fg=result
  65.  
  66. IF use_color="Yes" THEN
  67.     SETGENERALPREFS FG r||","||g||","||b
  68. /* Use the current font color if use_color=Yes */
  69.  
  70. GETDIMENSIONS
  71. dimensions=result
  72. w=WORD(dimensions,1)*10
  73. h=WORD(dimensions,2)*10
  74. /* Get the formula's size in micropoints */
  75.  
  76. EXPORT BINEPS "T:formula"||i FORCE
  77. /* save as Binary EPS */
  78.  
  79. SETGENERALPREFS FONTSIZE old_size
  80. SETGENERALPREFS FG old_fg
  81. /* restore old settings */
  82.  
  83. ADDRESS "FINALW.1"
  84.  
  85. SETMEASURE MICROPOINTS
  86.  
  87. CURRENTOBJECT
  88. id=result
  89.  
  90. x=-1
  91. y=-1
  92.  
  93. IF id~=0 THEN 
  94. DO
  95.         GETOBJECTCOORDS id
  96.         page=WORD(result,1)
  97.         x=WORD(result,2)
  98.         y=WORD(result,3)
  99.         DELETEOBJECT id
  100. END
  101. /* Use position of selected object (if there is one) */
  102.  
  103. SCREENTOFRONT
  104.  
  105. GETIMPORTPREFS TEXTFLOW LINKED DISPLAY 
  106.  
  107. PARSE VAR result t l d
  108.  
  109. IMPORTPREFS DISPLAY PREVIEW TEXTFLOW NONE LINKED NO
  110.  
  111. INSERTIMAGE "T:formula"||i POSITION page x y w h
  112. /* load the EPS-file into FW */
  113.  
  114. REDRAW
  115.  
  116. IMPORTPREFS TEXTFLOW t LINKED l DISPLAY d
  117.  
  118.  
  119.